Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@syncfusion/ej2-base
Advanced tools
@syncfusion/ej2-base is a foundational package for Syncfusion's Essential JS 2 library. It provides core utilities, base classes, and common functionalities that are used across various Syncfusion components. This package is essential for building and managing Syncfusion components in a consistent and efficient manner.
Event Handling
The EventHandler module allows you to add, remove, and manage event listeners on DOM elements. In this example, a click event listener is added to an element with the ID 'myElement'.
const { EventHandler } = require('@syncfusion/ej2-base');
function clickHandler() {
console.log('Element clicked');
}
const element = document.getElementById('myElement');
EventHandler.add(element, 'click', clickHandler);
Data Binding
The DataManager module provides a way to manage and query data collections. In this example, a DataManager is created with a simple array of objects, and a query is executed to find an object with an id of 1.
const { DataManager, Query } = require('@syncfusion/ej2-base');
const data = [
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' }
];
const dataManager = new DataManager(data);
const query = new Query().where('id', 'equal', 1);
dataManager.executeQuery(query).then((result) => {
console.log(result);
});
Utility Functions
The extend function is a utility that allows you to merge the properties of multiple objects into a single object. In this example, obj1 and obj2 are merged, with properties from obj2 overwriting those in obj1.
const { extend } = require('@syncfusion/ej2-base');
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const extendedObj = extend({}, obj1, obj2);
console.log(extendedObj); // Output: { a: 1, b: 3, c: 4 }
Lodash is a popular utility library that provides a wide range of functions for common programming tasks such as data manipulation, object handling, and more. It is similar to @syncfusion/ej2-base in terms of providing utility functions, but it is more general-purpose and widely used across different types of projects.
RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code. While @syncfusion/ej2-base focuses on utilities and base classes for Syncfusion components, RxJS provides powerful tools for handling asynchronous data streams and events.
Underscore is another utility library similar to Lodash, providing functional programming helpers without extending any built-in objects. It offers many of the same utilities as @syncfusion/ej2-base but is more focused on functional programming paradigms.
A common package of Essential JS 2 base libraries, methods and class definitions. It comes with full documentation and support and is available under commercial and community licenses – please visit www.syncfusion.com to get started.
Check the changelog here
FAQs
A common package of Essential JS 2 base libraries, methods and class definitions
The npm package @syncfusion/ej2-base receives a total of 139,354 weekly downloads. As such, @syncfusion/ej2-base popularity was classified as popular.
We found that @syncfusion/ej2-base demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.